<?php

/**
 * Yii view FacebookWidget
 *
 * @author luubk
 * @since Dec 2, 2012 - 11:47:40 AM
 */
class FBLikeBoxWidget extends CWidget {

    // Facebook Like Box Attributes
    public $href = 'https://www.facebook.com/dientudienmaythanglong'; //The URL of the Facebook Page for this Like Box
    public $colorscheme = 'light'; //The color scheme for the plugin. Options: 'light', 'dark'
    public $width = '205'; //The width of the plugin in pixels. Default width: 300px.
    public $height = '396'; //The height of the plugin in pixels. The default height varies based on number of faces to display, and whether the stream is displayed. With the stream displayed, and 10 faces the default height is 556px. With no faces, and no stream the default height is 63px.
    public $show_faces = 'true'; //specifies whether or not to display profile photos in the plugin. Default value: true.
    public $stream = 'false'; //specifies whether to display a stream of the latest posts from the Page's wall
    public $header = 'false'; //specifies whether to display the Facebook header at the top of the plugin
    public $border_color = '#ffffff'; //the border color of the plugin.
    public $force_wall = 'false'; //for Places, specifies whether the stream contains posts from the Place's wall or just checkins from friends. Default value: false.
    //
    // Widget Attributes
    var $baseUrl = 'http://www.facebook.com/plugins/likebox.php';
    var $url = 'http://www.facebook.com/plugins/likebox.php?href=http%3A%2F%2Fwww.facebook.com%2Fpages%2FL%25C6%25B0u-Anh-fan-club%2F127901317230821&width=240&height=258&show_faces=true&colorscheme=light&stream=false&border_color=%23ffffff&header=false';

    public function init() {

        $query_data = array(
            'href' => $this->href,
            'colorscheme' => $this->colorscheme,
            'width' => $this->width,
            'height' => $this->height,
            'show_faces' => $this->show_faces,
            'header' => $this->header,
            'border_color' => $this->border_color,
            'force_wall' => $this->force_wall,
        );
        $this->url = $this->baseUrl . '?' . http_build_query($query_data);
    }

    public function run() {
        $html = "<iframe src='$this->url' 
            scrolling='no' frameborder='0'  allowTransparency='true'             
            style='width:{$this->width}px; height:{$this->height}px;
                border:none; overflow:hidden;'></iframe>";
        echo $html;
    }

}

